import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/login',
    method: 'post',
    data
  })
}

export function getUserInfo(token) {
  return request({
    url: '/getUserInfo',
    method: 'post',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/logout',
    method: 'post'
  })
}

export function deletUser(id) {
  return request({
    url: '/deletUserByID/' + id,
    method: 'delete'
  })
}
export function getUserList(listQuery) {
  return request({
    url: '/getUserList',
    method: 'post',
    data: {
      dataName: listQuery.username,
      dataType: listQuery.type
    },
    params: {
      pageNum: listQuery.page,
      pageSize: listQuery.limit
    }
  })
}

export function createUser(data) {
  return request({
    url: '/insertUser',
    method: 'post',
    data
  })
}

export function updateUser(data) {
  return request({
    url: '/updateUserInfo',
    method: 'post',
    data
  })
}

export function fetchPerson(id) {
  return request({
    url: '/getPersonInfo',
    method: 'post',
    params: {id:id}
  })
}

export function updatePerson(data) {
  return request({
    url: '/updatePersonInfo',
    method: 'post',
    data
  })
}


